package sample;

import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.Tooltip;
import javafx.scene.control.cell.PropertyValueFactory;
import sample.model.StandardData;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public class StandardTableViewController implements Serializable {

//    private TableView tableViewstandard;
    public TableView tableView_standard;
    public TableColumn<StandardData, String> tc_year;
    public TableColumn<StandardData, String> tc_station;
    public TableColumn<StandardData, String> tc_mon;
    public TableColumn<StandardData, String> tc_day;
    public TableColumn<StandardData, String> tc_hour;
    public TableColumn<StandardData, String> tc_AP;
    public TableColumn tc_DBT;
    public TableColumn tc_RH;
    public TableColumn tc_DPT;
    public TableColumn tc_WD;
    public TableColumn tc_WS;
    public TableColumn tc_CC;
    public TableColumn tc_TH;
    public TableColumn tc_NR;
    public TableColumn tc_DF;

    public void init(){
//        tc_year.setCellValueFactory(new PropertyValueFactory<StandardData, String>("year"));
        tc_day.setCellValueFactory(new PropertyValueFactory<StandardData, String>("day"));
        tc_mon.setCellValueFactory(new PropertyValueFactory<StandardData, String>("month"));
        tc_station.setCellValueFactory(new PropertyValueFactory<StandardData, String>("station"));
        tc_hour.setCellValueFactory(new PropertyValueFactory<StandardData, String>("hour"));
        tc_AP.setCellValueFactory(new PropertyValueFactory<>("AP"));
        tc_DBT.setCellValueFactory(new PropertyValueFactory<StandardData, String>("DBT"));
        tc_RH.setCellValueFactory(new PropertyValueFactory<StandardData, String>("RH"));
        tc_DPT.setCellValueFactory(new PropertyValueFactory<StandardData, String>("DPT"));
        tc_WD.setCellValueFactory(new PropertyValueFactory<StandardData, String>("WD"));
        tc_WS.setCellValueFactory(new PropertyValueFactory<StandardData, String>("WS"));
        tc_CC.setCellValueFactory(new PropertyValueFactory<StandardData, String>("CC"));
        tc_TH.setCellValueFactory(new PropertyValueFactory<StandardData, String>("TH"));
        tc_NR.setCellValueFactory(new PropertyValueFactory<StandardData, String>("NR"));
        tc_DF.setCellValueFactory(new PropertyValueFactory<StandardData, String>("DF"));
    }
    public  void getPropList(){
//        Integer[] arr =(Integer[]) tc_DPT.getColumns().toArray();

        List<String> collect = (List<String>) tc_DPT.getColumns().stream().collect(Collectors.toList());
        Object[] objects = tc_DPT.getColumns().toArray();
//        return objects;
        return;
    }
}
